home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1984 May / 1984-05.d64 / joystick control (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  104 lines

  1. 15 rem  *        chase and tag        *
  2. 40 poke 53280,4 :poke 53281,14 :print "" :clr :co=54272:goto 700
  3. 50 rem *** indirect address registers ***
  4. 55 poke 52254,1 :poke 52246,2 :poke 52247,42 :poke 52245,82 :poke 52253,81
  5. 60 poke 52249,80 :poke 52251,40 :poke 52250,0 :poke 52255,41
  6. 65 poke 52126,1 :poke 52118,2 :poke 52119,42 :poke 52117,82 :poke 52125,81
  7. 70 poke 52121,80 :poke 52123,40 :poke 52122,0 :poke 52127,41
  8. 100 rem *** player movement with joystick ***
  9. 110 r = 1422 :l = 1385 :p = 0
  10. 120 poke r,81:poker+co,0:poke l,102:pokel+co,0
  11. 125 p = p+1
  12. 130 if p = 100 then goto 310
  13. 140 x = peek(56321)+52000
  14. 145 if x < 52245 then goto 140
  15. 150 m = peek(x)-41
  16. 160 y = peek(56320)+52000
  17. 165 if y < 52117 then goto 160
  18. 170 n = peek(y)-41
  19. 180 c = (r+m - 1063) / 40 :if c - int(c) = 0 then m = 0 :goto 210
  20. 190 g = (r+m - 1064) / 40 :if g - int(g) = 0 then m = 0 :goto 210
  21. 200 if r+m < 1063 or r+m > 1822 then m = 0
  22. 210 poke r,32:poker+co,0:r = r+m
  23. 220 poke r,81:poker+co,0
  24. 225 if t = 1 and r = l then goto 310
  25. 230 h = (l+n - 1063) / 40 :if h - int(h) = 0 then n = 0 :goto 260
  26. 240 b = (l+n - 1064) / 40 :if b - int(b) = 0 then n = 0 :goto 260
  27. 250 if l+n < 1063 or l+n > 1822 then n = 0
  28. 260 poke l,32 :pokel+co,0:l = l+n
  29. 270 poke l,102:pokel+co,0
  30. 275 if t = 0 and r = l then goto 310
  31. 280 if p = 80 then poke 53281,12
  32. 290 goto 125
  33. 300 rem *** the explosion ***
  34. 310 for b = 1 to 6
  35. 320 for a = 0 to 15 :poke 53281,a :next a
  36. 330 next b
  37. 340 poke l,32:pokel+co,0:poke r,32:poker+co,0
  38. 400 rem *** resetting the playing field and keeping score ***
  39. 410 poke 53281,1 :poke 1422,81:poke 1422+co,0:poke 1385,102:poke1385+co,0
  40. 420 if t = 0 and p = 100 then goto 610
  41. 430 if t = 1 and p < 100 then goto 610
  42. 500 rem *** updating the left players score ***
  43. 510 e = e+1
  44. 520 if e = 58 and f = 49 then goto 1300
  45. 530 if e = 58 then f = 49 :poke 1945,f:poke1945+co,0
  46. 540 if e = 58 then e = 48
  47. 550 poke 1976,9:poke1976+co,0:poke 1977,20:poke1977+co,0
  48. 560 poke 1946,e:poke1946+co,0:poke 1949,32:poke1949+co,0
  49. 565 poke 1950,32:poke1950+co,0:t = 1 :goto 110
  50. 600 rem *** updating the right players score ***
  51. 610 d = d+1
  52. 620 if d = 58 and qg = 49 then goto 1300
  53. 630 if d = 58 then qg = 49 :poke 1980,qg:poke1980+co,0
  54. 640 if d = 58 then d = 48
  55. 650 poke 1949,9:poke1949+co,0:poke 1950,20:poke1950+co,0
  56. 660 poke 1981,d:poke1981+co,0:poke 1976,32
  57. 665 poke 1976,32 :poke1976+co,0:poke 1977,32 :poke1977+co,0:t=0:goto 110
  58. 700 rem *** entering the players initials ***
  59. 710 poke53281,0:print "[147]":poke53281,1
  60. 720 print "[144]enter the left players 3 initials"
  61. 725 print"";
  62. 730 for kl = 1 to 3
  63. 735 getk$:ifk$=""then735
  64. 737 ifk$>"z"ork$<"a"then735
  65. 739 printk$;
  66. 740 im$(kl)=k$:next kl
  67. 750 poke53281,0:print "[147]":poke53281,1
  68. 760 print "enter the right players 3 initials"
  69. 765 print"";
  70. 770 for kr = 1 to 3
  71. 775 getk$:ifk$=""then775
  72. 777 ifk$>"z"ork$<"a"then775
  73. 779 printk$;
  74. 780 in$(kr)=k$:next kr
  75. 800 poke53281,0:print "[147]":poke53281,1
  76. 810 e = 48 :d = 48 :t = 0 :s = 1024 :v = 1824 :z = 1863
  77. 900 rem *** title on screen ***
  78. 910 data 34,32,3,8,1,19,5,32,1,14,4,32,20,1,7,32,34
  79. 920 for tt = 1 to 17 :read td :poke 1874+tt,td :next tt
  80. 1000 rem *** drawing the playing field ***
  81. 1010 poke s,108:pokes+co,0:for b = 1 to 38 :poke s+b,121:pokes+b+co,0:next b
  82. 1020 poke s+b,123 :for b = 79 to 799 step 40 :poke s+b,117:pokes+b+co,0:next b
  83. 1030 poke z,126 :for b = 38 to 1 step -1 :poke v+b,120:pokev+b+co,0:next b
  84. 1040 poke v,124:pokev+co,0:for b = 760 to 40 step -40 :poke s+b,118 :next b
  85. 1050 :
  86. 1100 rem *** initializing left players score ***
  87. 1110 le = 1905
  88. 1120 for kl = 1 to 3 :x = asc(im$(kl)) :poke le,x-64 :le = le+1 :next kl
  89. 1130 poke 1949,9:poke1949+co,0:poke 1950,20:poke1949+co,0:poke 1946,e
  90. 1135 poke1946+co,0
  91. 1200 rem *** initializing right players score ***
  92. 1210 re = 1940
  93. 1220 for kr = 1 to 3 :x = asc(in$(kr)) :poke re,x-64 :re = re+1 :next kr
  94. 1230 poke 1981,d:poke1981+co,0:goto 55
  95. 1300 poke53281,0:print "[147]":poke53281,1
  96. 1310 print " if you want to play another game"
  97. 1320 print " press 'y'[146] or 'n'[146].":poke198,0
  98. 1330 get an$:if an$="" then 1330
  99. 1340 if an$="n" then goto 1400
  100. 1350 if an$="y" then 40
  101. 1360 goto1330
  102. 1400 poke53281,0:print "[147]" :poke53281,1:print " bye"
  103. 1410 end
  104.